package com.huang.entity;

import javax.validation.constraints.NotNull;
import javax.validation.constraints.Null;

import com.baomidou.mybatisplus.annotation.*;
import com.huang.validation.SaveGroupInterface;
import com.huang.validation.UpdateGroupInterface;

import lombok.Data;

/**
 * @author han
 * @since 2021-10-12 17:01:26
 */
@Data
public class BaseEntity {

    @TableId(type = IdType.ASSIGN_ID)
    @Null(groups = {SaveGroupInterface.class}, message = "ID必须为空")
    @NotNull(groups = {UpdateGroupInterface.class}, message = "ID不能为空")
    private String id;
    // 0: 未删除 1：删除
    @TableField(fill = FieldFill.INSERT)
    private Integer deleted;
    @Version
    private Integer version;
    @TableField(fill = FieldFill.UPDATE)
    private Long modifyDate;
    @TableField(fill = FieldFill.INSERT)
    private Long createDate;
}
